use std::ops::Mul;

trait HasArea<T> {
    fn area(&self) -> T;
}

struct Square<T> {
    width: T,
    height: T,
}

impl<T> HasArea<T> for Square<T>
where
    T: Mul<Output = T> + Copy,
{
    fn area(&self) -> T {
        return self.height * self.width;
    }
}

#[test]
fn test_has_area() {
    let s = Square {
        width: 12,
        height: 13,
    };
    assert_eq!(12 * 13, s.area());
    println!("s.area() = {:?}", s.area());
}
